<?php
session_start(); 
if(!isset($_SESSION['userName'])){
header( 'location:../index.php' ); 
}
	include("../conf/connect.php");
	$user_id = $_SESSION['user_id'];
	$hid = $_SESSION['usrHHid'];
	$name = $_GET['name'];
	$id = $_GET['id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../style.css" media="screen" />
	<link rel="shortcut icon" href="images/favicon.ico" />
</head>
<body class="iub_back">
	<form method="post" action="answer.php?qus=rel_detail">
	<table align="center" class="table_border">			
			<tr>
					<td>10. Rel Detail: <HR /></td>				
			</tr>			
			<tr>
					<td>Name :</td>				
			</tr>
			<tr>
				<td >
					<select name="stn">
					<option value="" selected="selected" >Select</option>
					<?php
						$sql ="SELECT id,q1,status FROM raw_data where user_id='$user_id' and hid='$hid'";
						$result=mysql_query( $sql);
						$tr = mysql_num_rows($result);
						$tc=0;
						while($row = mysql_fetch_array($result)){
						$answer=$row['q1'];
					?>
						<option value="<?php echo $row['id'].":".$answer;?>"><?php if($row['status']=='1'){echo "x : ";$tc++;} echo $answer;?></option>
					<?php }?>
					</select>
				</td>
			</tr>
			
			<tr>
					<td  align="right">
						
						<?php 
							if($tc == $tr){
								$lastdata = mysql_query(" select * from track where user_id='$user_id' and hid ='$hid' order by id desc");
								$linkarray = mysql_fetch_array($lastdata);
								$resId=$linkarray['appid'];
								
								$sql_track="UPDATE track set qid='hc' WHERE appid='$resId' and user_id='$user_id' and hid = '$hid'";
								mysql_query($sql_track) or die ("problem budget_heads");
								echo "<a href='qus5.php?serial=a' class='input-box'>Done</a>";
							}
							else{
							echo "<input type='submit' value='Next' class='input-box' />";
							}
						?>
						
					</td>
			</tr>			
		</table>
		</form>
		
		
</body>
</html>